com.cete.dynamicpdf
Class ImportFormDataAction
Example : The following example shows how to use import form data action.
import com.cete.dynamicpdf.*;
import com.cete.dynamicpdf.pageelements.*;
import com.cete.dynamicpdf.pageelements.forms.*;
public class MyClass {
public static void main(String args[]) {
// Create a PDF Document
Document document = new Document();
// Create a page and add it to the document
Page page = new Page();
document.getPages().add(page);
Button button = new Button("btn", 50, 150, 100, 30);
button.setLabel("Click Here");
// Create label and text field
Label label1 = new Label("Click the button to fill the text field using import data action: ", 50, 100, 250, 30);
TextField field = new TextField("Text1", 320, 100, 100, 30);
// Add the label and form fields to the page
page.getElements().add(button);
page.getElements().add(field);
page.getElements().add(label1);
// Create a import form data action and assign to the button events.
ImportFormDataAction action = new ImportFormDataAction("[physicalpath]/dataFDF.fdf");
button.getReaderEvents().setMouseUp(action);
// Save the PDF
document.draw( "[physicalpath]/MyDocument.pdf" );
}
}